package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.sql.Time;
import java.util.Date;
import java.util.Objects;

@Entity
public class Merge {
    private long mergeId;
    private Date mergeDate;
    private String mergeDetail;
    private Employee employeeByYgId;
    private Customer customer;
    private Customer customered;

    @Basic
    @Column(name = "merge_detail")
    public String getMergeDetail() {
        return mergeDetail;
    }

    public void setMergeDetail(String mergeDetail) {
        this.mergeDetail = mergeDetail;
    }

    @ManyToOne
    @JoinColumn(name = "MERGE_NAME", referencedColumnName = "yg_id")
    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    @ManyToOne
    @JoinColumn(name = "MERGED_NAME", referencedColumnName = "yg_id")
    public Customer getCustomered() {
        return customered;
    }

    public void setCustomered(Customer customered) {
        this.customered = customered;
    }

    @Id
    @Column(name = "merge_id")
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public long getMergeId() {
        return mergeId;
    }

    public void setMergeId(long mergeId) {
        this.mergeId = mergeId;
    }

    @Basic
    @Column(name = "merge_date")
    public Date getMergeDate() {
        return mergeDate;
    }

    public void setMergeDate(Date mergeDate) {
        this.mergeDate = mergeDate;
    }

    @ManyToOne
    @JoinColumn(name = "yg_id", referencedColumnName = "yg_id")
    public Employee getEmployeeByYgId() {
        return employeeByYgId;
    }

    public void setEmployeeByYgId(Employee employeeByYgId) {
        this.employeeByYgId = employeeByYgId;
    }
}
